﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Trade.Journal
{
    /// <summary>
    /// BarTypeSelecter.xaml 的交互逻辑
    /// </summary>
    public partial class BarTypeSelecter : UserControl
    {
        public BarTypeSelecter()
        {
            InitializeComponent();

            ListView_BarType.ItemsSource = new ObservableCollection<BarCycle>(ConfigurationManager.GetSection("BarTypes") as List<BarCycle>);
            ListView_BarType.SetBinding(ListView.SelectedItemProperty, new Binding(nameof(SelectedCycle)) { Source = this });
        }



       


        public BarCycle SelectedCycle
        {
            get { return (BarCycle)GetValue(SelectedBarTypeProperty); }
            set { SetValue(SelectedBarTypeProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SelectedBarType.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SelectedBarTypeProperty =
            DependencyProperty.Register("SelectedCycle", typeof(BarCycle), typeof(BarTypeSelecter), new FrameworkPropertyMetadata(default(BarCycle), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));





    }
}
